Migrating from Microsoft FrontPage to Macromedia Dreamweaver MX 2004
Table of Contents
- Introduction
- Introducing the Dreamweaver Workspace
- Streamlining Your Workspace
- Setting Up a Web and Managing Files
- Working with Text
- Working with Styles and Style Sheets
- Working with Images
- Creating Links
- Creating Tables
- Using Layout Mode to Position Text and Images
- Using Predesigned Pages to Get a Head Start
- Making Quick Edits to Code
- Working in Code View
- Editing Code in Code View
- Customizing Your Coding Environment
- Taking the Next Steps
Working With Styles and Style Sheets
Styles are often used in FrontPage and Word to format text and paragraphs. If you’re used to working with styles, you can keep working with them in Dreamweaver.
Dreamweaver creates a CSS style when you format a text selection (see Working with text). CSS stands for Cascading Style Sheet, a web technology that gives you precise control over the appearance of your web pages. In addition to formatting text, CSS styles let you set margins, borders, float text around other text, and so on.
Like FrontPage or Word styles, CSS styles make it easy to update the formatting of your pages. When you update a CSS style, it automatically updates the formatting of all page elements using that style. In Dreamweaver, you can choose from numerous predefined CSS styles sheets or you can create your own styles.
To create a new style:
In the CSS Styles panel (Window > CSS Styles), click the New CSS Style button (+) on the bottom of the panel.
The New CSS Style dialog box appears.
Figure 15. The New CSS Style dialog box
Select a selector type.
Dreamweaver supports class selectors and tag selectors. A class selector defines a new named style, such as myBodyText. Once defined, you can apply the myBodyText style to any text selection.
A tag selector applies to all HTML tags of a particular type. For example, if you select the table row tag,
tr, and set thefontto Helvetica; this then applies the Helvetica font automatically to all table rows.Select the location where you want to define the new style, as follows:
- To define the style in a new external style sheet, select New Style Sheet File.
- To define the style in an existing style sheet attached to the current document, select the CSS file from the Define In pop-up menu.
- To embed the style in the current document, select This Document Only.
Click OK.
The New CSS Style dialog box closes and the Style Definition dialog box opens.
Figure 16. The CSS Style definition dialog box
- Use the Style Definition dialog box options to define the new CSS style.
When you’re done, click OK.
To use a predefined style sheet:
- Choose File > New to open the New Document dialog box.
- In the Category list, select CSS Style Sheets.
-
In the CSS Style Sheets list, select the style sheet you want. Dreamweaver displays a preview of the styles as well as a brief description of the style sheet.
Figure 17. The Styles preview dialog box
- To create the style sheet, click Create or double-click the item in the list. The style sheet appears in code format in the Document window.
Choose File > Save to save the document.
Before you can apply the styles defined in an external style sheet, you must attach the style sheet to your pages.
To attach a style sheet to your pages:
- Open a page and then open the CSS Styles panel (Window > CSS Styles).
Click the Attach Style Sheet button at the bottom of the CSS Styles panel.
Figure 18. The Attach Style Sheet button
- Browse to the style sheet and select it.
The individual styles appear in the CSS Styles panel. They also appear in the Style pop-up menu in the Property inspector.
Figure 19. The Property inspector style pop-up menu
To apply styles:
Click or select a page element and do one of the following:
- In the Property inspector, select the style from the Style pop-up menu.
- Right-click the selection in Design view and select the style from the CSS Styles submenu in the context menu.
- In the CSS Styles panel (Window > CSS Styles), right-click the style you want to apply and select Apply from the context menu.
To modify styles:
- In the CSS Styles panel (Window > CSS Styles), select the style you want to modify.
Click the Edit Style button at the bottom of the CSS Styles panel.
Figure 20. The Edit Style button
Modify the style attributes in the Style Definition dialog box.
Figure 21. The CSS Style Definition dialog box
- Click OK.
For more information, see the following topics in Using Dreamweaver Help:
- "Linking to or importing an external CSS style sheet"
- "Creating a new CSS style"
- "Editing a CSS style sheet"
- "Editing a CSS style"